
let p1 = new Promise((resolve,reject) => {
    setTimeout(()=> {
        resolve(1);
        // reject('err in '); 
    },1000)

})

let p2 = new Promise((resolve,reject) => {
    setTimeout(()=> {
        // resolve(2); 
        reject('err in '); 

    },2000)

})

let p3 = new Promise((resolve,reject) => {

    setTimeout(()=> {
        resolve(3); 
    },3000)

}).catch((err,res) => {
    return err;
})

let start = Date.now();

let p = Promise.all([p1,p2,p3]).then(res => {
    console.log(res,'---');
    console.log(Date.now() - start);
}).catch((err,res) => {
    console.log(err,res);
    console.log(Date.now() - start);
});



// console.log(p);